package org.osforce.platform.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.MappedSuperclass;
import javax.persistence.OneToOne;


/**
 * 
 * @author gavin
 * 
 */
@MappedSuperclass
public abstract class Archive extends IdEntity{

	private static final long serialVersionUID=8633349746062726813L;

	private String name;
	private Long clicks=0L;
	private Date enterDate;
	private Date publicDate;

	private Category category;
	private Status status;
	private User author;
	private User editor;

	public Archive(){
	}

	@Column(name="name",length=100,nullable=false)
	public String getName(){
		return name;
	}

	public void setName(String name){
		this.name=name;
	}

	@Column(name="clicks",nullable=false)
	public Long getClicks(){
		return clicks;
	}

	public void setClicks(Long clicks){
		this.clicks=clicks;
	}

	@Column(name="enterdate",nullable=false)
	public Date getEnterDate(){
		return enterDate;
	}

	public void setEnterDate(Date enterDate){
		this.enterDate=enterDate;
	}

	@Column(name="publicdate",nullable=false)
	public Date getPublicDate(){
		return publicDate;
	}

	public void setPublicDate(Date publicDate){
		this.publicDate=publicDate;
	}
	
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="category")
	public Category getCategory(){
		return category;
	}

	public void setCategory(Category category){
		this.category=category;
	}
	
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="status")
	public Status getStatus(){
		return status;
	}

	public void setStatus(Status status){
		this.status=status;
	}
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="author")
	public User getAuthor(){
		return author;
	}

	public void setAuthor(User author){
		this.author=author;
	}
	@OneToOne(cascade={CascadeType.ALL})
	@JoinColumn(name="editor")
	public User getEditor(){
		return editor;
	}

	public void setEditor(User editor){
		this.editor=editor;
	}

}
